using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace ChatControls
{
	/// <summary>
	/// Summary description for UserControl1.
	/// </summary>
	public class ChatMasalaContact : System.Windows.Forms.UserControl
	{
		private System.Windows.Forms.Label txtContact;
		private System.Windows.Forms.PictureBox picSmiley;
		private System.Windows.Forms.ImageList imageList;
		private System.ComponentModel.IContainer components;

		public ChatMasalaContact()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
			picSmiley.Image=imageList.Images[0];
		}
		public ChatMasalaContact(string contact)
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
			picSmiley.Image=imageList.Images[0];
			txtContact.Text=contact;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if( components != null )
					components.Dispose();
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ChatMasalaContact));
			this.picSmiley = new System.Windows.Forms.PictureBox();
			this.txtContact = new System.Windows.Forms.Label();
			this.imageList = new System.Windows.Forms.ImageList(this.components);
			this.SuspendLayout();
			// 
			// picSmiley
			// 
			this.picSmiley.Location = new System.Drawing.Point(0, 0);
			this.picSmiley.Name = "picSmiley";
			this.picSmiley.Size = new System.Drawing.Size(16, 16);
			this.picSmiley.TabIndex = 0;
			this.picSmiley.TabStop = false;
			this.picSmiley.DoubleClick += new System.EventHandler(this.picSmiley_DoubleClick);
			// 
			// txtContact
			// 
			this.txtContact.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtContact.Location = new System.Drawing.Point(24, 0);
			this.txtContact.Name = "txtContact";
			this.txtContact.Size = new System.Drawing.Size(144, 16);
			this.txtContact.TabIndex = 1;
			this.txtContact.Text = "Contact";
			this.txtContact.DoubleClick += new System.EventHandler(this.txtContact_DoubleClick);
			// 
			// imageList
			// 
			this.imageList.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
			this.imageList.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// ChatMasalaContact
			// 
			this.BackColor = System.Drawing.Color.White;
			this.Controls.Add(this.txtContact);
			this.Controls.Add(this.picSmiley);
			this.Name = "ChatMasalaContact";
			this.Size = new System.Drawing.Size(176, 16);
			this.Resize += new System.EventHandler(this.ChatMasalaContact_Resize);
			this.ResumeLayout(false);

		}
		#endregion

		private void ChatMasalaContact_Resize(object sender, System.EventArgs e)
		{
			txtContact.Width=this.Width-32;
			this.Height=16;
		}

		public bool online;

		private void txtContact_DoubleClick(object sender, System.EventArgs e)
		{
			this.OnDoubleClick(new EventArgs());
		}

		private void picSmiley_DoubleClick(object sender, System.EventArgs e)
		{
			this.OnDoubleClick(new EventArgs());
		}

		public bool Online
		{
			get
			{
				return online;
			}
			set
			{
				online=value;
				if(value)
				{
					picSmiley.Image=imageList.Images[1];
				}
				else
				{
					picSmiley.Image=imageList.Images[0];
				}
				picSmiley.Update();
				picSmiley.Refresh();
			}
		}
		public string Contact
		{
			get
			{
				return txtContact.Text;
			}
			set
			{
				txtContact.Text=value;
			}
		}
	}
}
